<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>index</title>
    <style type="text/css">
        span {
            color: red;
        }
    </style>
</head>
<body>
<div>
    <h1>用户登录</h1>
</div>
<div>
    <script type="text/javascript">
        window.onload = function () {
            var null_name = document.getElementById("null-name");
            var null_password = document.getElementById("null-password");
            var name_text = document.getElementById("name");
            var password_text = document.getElementById("password");
            name_text.onblur = function () {
                if (name_text.value == "") {
                    null_name.innerText = "用户名不能为空";
                }
            }
            name_text.onfocus = function () {
                null_name.innerText = "";
            }

            password_text.onblur = function () {
                if (password_text.value == "") {
                    null_password.innerText = "密码不能为空";
                }
            }

            password_text.onfocus = function () {
                null_password.innerText = "";
            }

            var register = document.getElementById("btn_register")
            register.onclick = function () {

            }


            var log_form = document.getElementById("log_form");
            log_form.onsubmit = function () {
                if (name_text.value == "" || password_text.value == "") {
                    return false;
                }
                return true;
            }

        }

    </script>
    <form action="/user/login" method="post" id="log_form">
        <input id="name" type="text" name="name">
        <label for="name">用户名</label><br>
        <span id="null-name"></span><br>
        <input id="password" type="password" name="password">
        <label for="password">密码</label><br>
        <span id="null-password"></span><br>
        <div>
            <input type="submit" value="登录">
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <input type="button" value="注册" id="btn_register">
        </div>
    </form>
    <br>

    <a href="/manager/login" id="login_manager">有管理员账号?请点击这里登录</a>

</div>

</body>
</html>